package ces.lawsuit.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

import ces.lawsuit.model.User;
import ces.lawsuit.util.App;
import ces.lawsuit.util.Util;
/*登陆权限拦截器*/
public class LoginInterceptor implements Interceptor {

	@Override
	public void intercept(Invocation inv) {
		
     Controller controller=   inv.getController();
     User user=controller.getSessionAttr(App.USER_SESSION_KEY);
     if(inv.getActionKey().contains("login")){
    	 inv.invoke();
     }else 
     if(Util.isNull(user)){
    	controller.render("/common/timeOut.html");
     }
	}

}
